<!--  -->
<template>
  <div class="tab-control">
      <div v-for="(item,index) in titles" class="tab-control-item" :class="{'tab-active':currentIndex === index}" @click="tabItemClick(index)">
          <span>{{item}}</span>
      </div>
     
  </div>
</template>

<script>
export default {
  data () {
    return {
      currentIndex:0
    }
  },
  props:{
    titles:{
      type:Array,
      default(){
        return []
      }
    }
  },
  methods: {
    tabItemClick(index){
      this.currentIndex = index
    }
  },
}
</script>

<style  scoped>
.tab-control{
  display: flex;
  background-color: rgb(245, 245, 245);
  width: 100%;
}
  .tab-control-item{
    flex: 1;
    text-align: center;
    line-height: 48px;
    font-size: 20px;
   
  }
  .tab-active{
    color: var(--color-high-text);
    
  }
  .tab-active span{
    padding: 5px;
    border-bottom: 3px solid var(--color-high-text);
  }
</style>
